const url = require('node:url');

//创建url网址对象
const myURL =
  new URL('https://http://localhost/:8080/goods/getAll?id=1001');

  console.log(myURL);
  console.log(myURL.pathname);
  console.log(myURL.hash);
  console.log(myURL.host);
  console.log(myURL.searchParams.get("id"));
  myURL.searchParams.append("name","西瓜");
  myURL.searchParams.delete("id");
  console.log(myURL.searchParams);